using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using RetailAnalytic.Core;
namespace RetailAnalytic.Shell
{
    public partial class FrmSysConst : frmTemplate
    {
        public FrmSysConst()
        {
            InitializeComponent();
            SetGuiAppearance();
            listView1.Items[0].Selected = true;
        }
        private void SetGuiAppearance()
        {
            this.Icon = SR.ImagesLibrary.GetIconByName("asp");
            this.imageList1.Images.Clear();
            this.imageList1.Images.Add("0",SR.ImagesLibrary.GetImageByName("properties"));
            this.imageList1.Images.Add("1", SR.ImagesLibrary.GetImageByName("database"));
            this.imageList1.Images.Add("2", SR.ImagesLibrary.GetImageByName("set_Page"));
            this.imageList1.Images.Add("3", SR.ImagesLibrary.GetImageByName("roles"));
        }
        private void FrmSysConst_Load(object sender, EventArgs e)
        {
            //propertyGrid1.SelectedObject = _RA.SystemConfiguration; 
        }
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                propertyGrid1.SelectedObject = null;
                switch (listView1.SelectedItems[0].Index)
                {
                    case 0:
                        try
                        {
                            propertyGrid1.SelectedObject = new SystemConfiguration_();
                            ucStatusExecute1.SetStatus(false, "", "");
                        }
                        catch (Exception ex)
                        {
                            Dialog.Show(Dialog_type.Error, SR.StringLibrary.GetStrMSG(SR.StringLibrary.KeyEnum.MESSAGE_EMPTY,
                                Environment.StackTrace, ex));
                            ucStatusExecute1.SetStatus( true, ex.Message , ex.StackTrace );
                        }
                        break;
                    case 1:
                        propertyGrid1.SelectedObject = RetailAnalytic.Core.Properties.Settings.Default;
                        ucStatusExecute1.SetStatus(false, "", "");
                        break;
                    case 2:
                        break;
                    default:
                        break;
                }
            }
            catch (Exception)
            {

                //throw;
            }
        }
        private void ultraButton1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}